<template>
	<view class="cust_detail">
		<view class="record_item" v-for="(item,index) in list" :key="index">
			<image :src="BASE_IMG_URL +'membercard.png'"  mode="scaleToFill"></image>
			<view class="record_info">
				<view class="record_time">
					<view>{{item.card_name}}<br>{{item.addTime}}</view>
					<view></view>
				</view>
				<view style="padding: 10rpx 100rpx;margin-top: 30rpx;">
					<view v-for="card in item.card_content">
					<view  v-if="card.goods_type==2">储值：[{{card.consume}}/{{card.price}}]  赠送：[{{card.giveSurplus}}/{{card.giveAmount}}]</view>
					<view  v-if="card.goods_type!=2">{{card.goods.goods_name}} [{{card.surplus}}/{{card.count}}]</view>
					</view>
				</view> 
			</view>
		</view>
		<view style="height: 200rpx;"></view>
		<u-empty v-if="list.length == 0" text="暂无更多"></u-empty>
	</view>
</template>

<script>
	import { netCardSurplusRecord } from '@/api/kehu.js'
	import { BASE_IMG_URL } from '@/util/api.js'
	export default {
		data() {
			return {
				
				page: 1,
				totalPage: 1,
				limit: 10,
				list: [], //操作记录
				memberId: '',
				type:'',
				BASE_IMG_URL : BASE_IMG_URL
			}
		},
		onLoad(options) {
			this.memberId = options.id
			this.type = options.relation_type
			//操作记录
			this.getList()
		},
		onReachBottom() {
			if (this.page >= this.totalPage) {
				return
			}
			this.page++
			this.getList()
		},
		onShow() {
			
		},
		created() {

		},
		methods: {
			//操作 记录
			getList() {
				let params = {
					page: this.page,
					limit: this.limit,
					memberId: this.memberId
				}
				netCardSurplusRecord(params).then(res => {
					this.list = res.data.list
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.cust_detail {
		.record_item{
			margin-top: 20rpx;
			background: #fff;
			image{
				width: 80rpx;
				height: 80rpx;
				border-radius: 50%;
				margin: 30rpx;
				float: left;
			}
			.record_info{
				font-size: 30rpx;
				color: #999;
				.record_time{
					padding-top: 30rpx;
					display: flex;
					justify-content: space-between;
					padding-right:30rpx ;
				}
			}
		}
	}
</style>
